package robocup.component.speechacts.coachlanguage;

import java.util.LinkedList;

public class Directive {

  private boolean                   doIt       = false;

  private boolean                   teamOur    = false;

  private UnumSet                   unumSet    = null;

  private LinkedList<ActionElement> actionList = new LinkedList<ActionElement>();

  private String                    clangStr   = "";

  public void addAction(final ActionElement a) {

    this.actionList.add(a);
  }

  public LinkedList<ActionElement> getActionList() {

    return this.actionList;
  }

  public void setActionList(final LinkedList<ActionElement> actionList) {

    this.actionList = actionList;
  }

  public String getClangStr() {

    return this.clangStr;
  }

  public void setClangStr(final String clangStr) {

    this.clangStr = clangStr;
  }

  public boolean isDoIt() {

    return this.doIt;
  }

  public void setDoIt(final boolean doIt) {

    this.doIt = doIt;
  }

  public boolean isTeamOur() {

    return this.teamOur;
  }

  public void setTeamOur(final boolean teamOur) {

    this.teamOur = teamOur;
  }

  public UnumSet getUnumSet() {

    return this.unumSet;
  }

  public void setUnumSet(final UnumSet unumSet) {

    this.unumSet = unumSet;
  }

  @Override
  public String toString() {

    final StringBuffer buf = new StringBuffer();
    String dont = "";
    String team = "";

    if (this.clangStr.matches("")) {
      if (this.doIt) {
        dont = "do ";
      }
      else {
        dont = "dont ";
      }
      if (this.teamOur) {
        team = "our";
      }
      else {
        team = "opp";
      }
      buf.append("(" + dont + team + this.unumSet.toString());
      for (final ActionElement action : this.actionList) {
        buf.append(" " + action.toString());
      }
      buf.append(")");
    }
    else {
      buf.append(this.clangStr);
    }

    return buf.toString();
  }

}
